import MultipartPostHandler, urllib2, cookielib
import threading

def sendpng():
    cookies = cookielib.CookieJar()
    opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookies),
                                    MultipartPostHandler.MultipartPostHandler)
    filename = "E:\\Program Files\\Tencent\\QQ\\Users\\274103453\\Image\\5.jpg"
    params = { "userId" : "abcd123456",
                 "file" : open(filename, "rb") }
    response = opener.open("http://127.0.0.1:8001/image/upload/", params)
    print response.fp.read()

tlist = []
_num = 10
for i in range(_num):
    tlist.append(threading.Thread(target=sendpng))
for i in range(_num):
    tlist[i].start()
    